home *** CD-ROM | disk | FTP | other *** search
/ QuickTime VR Showcase / QuickTime VR Showcase.iso / 3rd Parties / Services / VRToolworks / Museum.Dxr / 00029.ls < prev    next >
Encoding:
Text File  |  1996-12-06  |  11.4 KB  |  380 lines

  1. on startMovie
  2.   global gPanoMovieID, gNavMovieID, gPathName, gLastTimeRollover, gPanoFrame, gQTVRCallBackFactory
  3.   set gPanoMovieID to EMPTY
  4.   set gNavMovieID to EMPTY
  5.   set gPathName to EMPTY
  6.   set gLastTimeRollover to 0
  7.   set gPanoFrame to EMPTY
  8.   set the visible of sprite 8 to 0
  9.   set the visible of sprite 9 to 0
  10.   openXLib("QuickTime VR XCMDs")
  11.   RegisterComponent(the pathName & "QuickTime VR Components", EMPTY)
  12.   set gQTVRCallBackFactory to CallBackTracer(mnew)
  13.   setCallBack(#PanoMovie, gQTVRCallBackFactory)
  14. end
  15.  
  16. on stopMovie
  17.   global gQTVRCallBackFactory
  18.   ClosePanoMovie()
  19.   CloseNavMovie()
  20.   closeXLib("QuickTime VR XCMDs")
  21.   if objectp(gQTVRCallBackFactory) then
  22.     gQTVRCallBackFactory(mdispose)
  23.   end if
  24. end
  25.  
  26. on OpenNavMovie pFilename, pSpriteNum, pShowOnOpen
  27.   global gNavMovieID
  28.   CloseNavMovie()
  29.   set tnavRect to the left of sprite pSpriteNum & "," & the top of sprite pSpriteNum & "," & the right of sprite pSpriteNum & "," & the bottom of sprite pSpriteNum
  30.   put tnavRect
  31.   set gNavMovieID to NavMovie("openMovie", "Direct", pFilename, the left of sprite pSpriteNum & "," & the top of sprite pSpriteNum, "ShowPoster", "Invisible")
  32.   if gNavMovieID contains "error" then
  33.     put gNavMovieID
  34.     set gNavMovieID to EMPTY
  35.     beep()
  36.     exit
  37.   end if
  38. end
  39.  
  40. on ShowNavMovie
  41.   global gNavMovieID
  42.   if gNavMovieID <> EMPTY then
  43.     NavMovie("Direct", gNavMovieID, "update")
  44.   end if
  45. end
  46.  
  47. on ZoomNavMovie pStartZoomRect, pSkipFirstFrame, pClipRect
  48.   global gNavMovieID
  49.   if gNavMovieID <> EMPTY then
  50.     set tCommand to "ZoomOutMovie" && QUOTE & pStartZoomRect & QUOTE
  51.     if not voidp(pSkipFirstFrame) then
  52.       set tCommand to tCommand & "," & pSkipFirstFrame
  53.     end if
  54.     if not voidp(pClipRect) then
  55.       set tCommand to tCommand & "," & QUOTE & pClipRect & QUOTE
  56.     end if
  57.     NavMovie("Direct", gNavMovieID, tCommand)
  58.     NavMovie("Direct", gNavMovieID, "idle")
  59.   end if
  60. end
  61.  
  62. on SetNavMovieView pHPan, pVPan
  63.   global gNavMovieID
  64.   if gNavMovieID <> EMPTY then
  65.     NavMovie("Direct", gNavMovieID, "set", "hPanAngle", pHPan)
  66.     NavMovie("Direct", gNavMovieID, "set", "vPanAngle", pVPan)
  67.   end if
  68. end
  69.  
  70. on CloseNavMovie
  71.   global gNavMovieID
  72.   if gNavMovieID <> EMPTY then
  73.     NavMovie("Direct", gNavMovieID, "dispose")
  74.     set gNavMovieID to EMPTY
  75.   end if
  76. end
  77.  
  78. on NavFrameScript pSpriteNum
  79.   global gNavMovieID
  80.   if (gNavMovieID <> EMPTY) and (RunningInForeground() = "true") then
  81.     if rollOver(pSpriteNum) then
  82.       NavMovie("Direct", gNavMovieID, "mouseOver")
  83.       cursor(200)
  84.       cursor(-1)
  85.     else
  86.       NavMovie("Direct", gNavMovieID, "idle")
  87.     end if
  88.   end if
  89. end
  90.  
  91. on OpenPanoMovie pFilename, pSpriteNum, pShowOnOpen
  92.   global gPanoMovieID, gPathName
  93.   ClosePanoMovie()
  94.   set tPanoRect to the left of sprite pSpriteNum & "," & the top of sprite pSpriteNum & "," & the right of sprite pSpriteNum & "," & the bottom of sprite pSpriteNum
  95.   set gPanoMovieID to PanoMovie("openMovie", "Direct", pFilename, tPanoRect)
  96.   if gPanoMovieID contains "error" then
  97.     put gPanoMovieID
  98.     set gPanoMovieID to EMPTY
  99.     beep()
  100.     exit
  101.   end if
  102.   set gPathName to ExtractPathName(pFilename)
  103.   InitPanoCallbacks()
  104. end
  105.  
  106. on InitPanoCallbacks
  107.   global gPanoMovieID
  108.   if gPanoMovieID <> EMPTY then
  109.     PanoMovie("Direct", gPanoMovieID, "set", "mouseOverHandler", EMPTY)
  110.     PanoMovie("Direct", gPanoMovieID, "set", "rolloverHotSpotHandler", "sampleRolloverHandler")
  111.     PanoMovie("Direct", gPanoMovieID, "set", "mouseDownHandler", EMPTY)
  112.     PanoMovie("Direct", gPanoMovieID, "set", "panZoomStartHandler", EMPTY)
  113.     PanoMovie("Direct", gPanoMovieID, "set", "mouseStillDownHandler", EMPTY)
  114.     PanoMovie("Direct", gPanoMovieID, "set", "nodeLeaveHandler", EMPTY)
  115.   end if
  116. end
  117.  
  118. on ShowPanoMovie pQuality
  119.   global gPanoMovieID
  120.   if gPanoMovieID <> EMPTY then
  121.     if not voidp(pQuality) then
  122.       PanoMovie("Direct", gPanoMovieID, "set", "quality", pQuality)
  123.     end if
  124.     PanoMovie("Direct", gPanoMovieID, "update")
  125.   end if
  126. end
  127.  
  128. on SetPanoNode pNodeID, pUpdate, pQuality
  129.   global gPanoMovieID
  130.   if gPanoMovieID <> EMPTY then
  131.     PanoMovie("Direct", gPanoMovieID, "set", "nodeID", pNodeID)
  132.     if not voidp(pQuality) then
  133.       PanoMovie("Direct", gPanoMovieID, "set", "quality", pQuality)
  134.     end if
  135.     if pUpdate then
  136.       PanoMovie("Direct", gPanoMovieID, "Update")
  137.     end if
  138.   end if
  139. end
  140.  
  141. on SwingPanoMovie pHPan, pVPan, pZoom, pSwingSpeed, pSwingQuality, pFinalQuality
  142.   global gPanoMovieID
  143.   if gPanoMovieID <> EMPTY then
  144.     PanoMovie("Direct", gPanoMovieID, "set", "zoomAngle", pZoom)
  145.     PanoMovie("Direct", gPanoMovieID, "set", "vPanAngle", pVPan)
  146.     PanoMovie("Direct", gPanoMovieID, "set", "hPanAngle", pHPan)
  147.     PanoMovie("Direct", gPanoMovieID, "set", "quality", pSwingQuality)
  148.     PanoMovie("Direct", gPanoMovieID, "set", "transitionMode", "swing")
  149.     PanoMovie("Direct", gPanoMovieID, "set", "transitionSpeed", pSwingSpeed)
  150.     PanoMovie("Direct", gPanoMovieID, "update")
  151.     PanoMovie("Direct", gPanoMovieID, "set", "transitionMode", "normal")
  152.     if pFinalQuality <> pSwingQuality then
  153.       PanoMovie("Direct", gPanoMovieID, "set", "quality", pFinalQuality)
  154.       PanoMovie("Direct", gPanoMovieID, "update")
  155.     end if
  156.   end if
  157. end
  158.  
  159. on CollapsePanoMovie
  160.   global gPanoMovieID
  161.   if gPanoMovieID <> EMPTY then
  162.     PanoMovie("Direct", gPanoMovieID, "CollapseToHotSpotRgn")
  163.   end if
  164. end
  165.  
  166. on SetPanoMovieView pHPan, pVPan, pZoom, pQuality
  167.   global gPanoMovieID
  168.   if gPanoMovieID <> EMPTY then
  169.     PanoMovie("Direct", gPanoMovieID, "set", "zoomAngle", pZoom)
  170.     PanoMovie("Direct", gPanoMovieID, "set", "vPanAngle", pVPan)
  171.     PanoMovie("Direct", gPanoMovieID, "set", "hPanAngle", pHPan)
  172.     if not voidp(pQuality) then
  173.       PanoMovie("Direct", gPanoMovieID, "set", "quality", pQuality)
  174.     end if
  175.     PanoMovie("Direct", gPanoMovieID, "update")
  176.   end if
  177. end
  178.  
  179. on ClosePanoMovie
  180.   global gPanoMovieID
  181.   if gPanoMovieID <> EMPTY then
  182.     PanoMovie("Direct", gPanoMovieID, "dispose")
  183.     set gPanoMovieID to EMPTY
  184.   end if
  185. end
  186.  
  187. on PanoFrameScript pSpriteNum
  188.   global gLastTimeRollover, gPanoMovieID, gLastPanoMovieData, gPathName, gNavMovieID, gPanoFrame
  189.   if rollOver(pSpriteNum) then
  190.     if (gPanoMovieID <> EMPTY) and (RunningInForeground() = "true") then
  191.       PanoMovie("Direct", gPanoMovieID, "mouseOver")
  192.       set tMouseOverResult to the result
  193.       if tMouseOverResult <> 0 then
  194.         set tAction to item 1 of tMouseOverResult
  195.         if tAction = "jump" then
  196.           put item 2 of tMouseOverResult into field "Current Node ID"
  197.         else
  198.           if tAction = "stil" then
  199.             put item 2 of tMouseOverResult into field "Current Hot Spot ID"
  200.           else
  201.             if tAction = "navg" then
  202.               set tHotSpotID to item 2 of tMouseOverResult
  203.               put tHotSpotID into field "Current Hot Spot ID"
  204.               set tStartZoom to PanoMovie("Direct", gPanoMovieID, "get", "navgZoomRect")
  205.               set tViewAngles to PanoMovie("Direct", gPanoMovieID, "get", "navgViewAngles")
  206.               set tFileName to PanoMovie("Direct", gPanoMovieID, "get", "hotSpotName")
  207.               CollapsePanoMovie()
  208.               OpenNavMovie(gPathName & ":" & tFileName, 2, 0)
  209.               if gNavMovieID <> EMPTY then
  210.                 set gPanoFrame to marker(0)
  211.                 go("Object From Pano")
  212.                 SetNavMovieView(item 1 of tViewAngles, item 2 of tViewAngles)
  213.                 set tClipRect to the left of sprite 2 & "," & the top of sprite 2 & "," & the right of sprite 2 & "," & the bottom of sprite 2
  214.                 ZoomNavMovie(tStartZoom, "true", tClipRect)
  215.               else
  216.                 PanoMovie("Direct", gPanoMovieID, "update")
  217.               end if
  218.             else
  219.               if tAction = "misc" then
  220.                 put item 2 of tMouseOverResult into field "Current Hot Spot ID"
  221.               else
  222.                 if tAction = "undf" then
  223.                   put item 2 of tMouseOverResult into field "Current Hot Spot ID"
  224.                 else
  225.                   if tAction = "pan " then
  226.                   end if
  227.                 end if
  228.               end if
  229.             end if
  230.           end if
  231.         end if
  232.         set gLastTimeRollover to 1
  233.       else
  234.         if rollOver(pSpriteNum) then
  235.           set gLastTimeRollover to 1
  236.         else
  237.           cursor(200)
  238.           cursor(-1)
  239.           set gLastTimeRollover to 0
  240.         end if
  241.       end if
  242.     end if
  243.   else
  244.     if gLastTimeRollover then
  245.       cursor(200)
  246.       cursor(-1)
  247.       set gLastTimeRollover to 0
  248.       if gPanoMovieID <> EMPTY then
  249.         PanoMovie("Direct", gPanoMovieID, "idle")
  250.       end if
  251.     end if
  252.   end if
  253. end
  254.  
  255. on SampleMouseOverHandler
  256.   global gPanoMovieID
  257.   put "Mouse over panoramic movie"
  258.   if gPanoMovieID <> EMPTY then
  259.   end if
  260. end
  261.  
  262. on SampleRolloverHandler pHotSpotID
  263.   put pHotSpotID into field "Current Hot Spot ID"
  264. end
  265.  
  266. on SampleMouseDownHandler
  267.   global gPanoMovieID
  268.   put "Mouse down during mouseOver call"
  269.   if gPanoMovieID <> EMPTY then
  270.     PanoMovie("Direct", gPanoMovieID, "PassMouseDown")
  271.   end if
  272. end
  273.  
  274. on SamplePanZoomStartHandler
  275.   put "About to pan or zoom in panoramic movie"
  276. end
  277.  
  278. on SampleMouseStillDownHandler
  279.   global gPanoMovieID
  280.   put "Enter mouse still down from panoramic movie"
  281.   if gPanoMovieID <> EMPTY then
  282.   end if
  283.   put "Leave mouse still down from panoramic movie"
  284. end
  285.  
  286. on SampleNodeLeaveHandler pToNode
  287.   put "Jumping to node " & pToNode & " in panoramic movie"
  288. end
  289.  
  290. on ExtractPathName pPathName
  291.   set tDelimiter to ":"
  292.   if pPathName contains tDelimiter then
  293.     set tCharPos to length(pPathName)
  294.     repeat while tCharPos >= 1
  295.       if char tCharPos of pPathName = tDelimiter then
  296.         return char 1 to tCharPos - 1 of pPathName
  297.       end if
  298.       set tCharPos to tCharPos - 1
  299.     end repeat
  300.     return EMPTY
  301.   else
  302.     return EMPTY
  303.   end if
  304. end
  305.  
  306. on SetupHandler pHandlerName
  307.   global gPanoMovieID
  308.   if the hilite of cast (pHandlerName && "Check") then
  309.     PanoMovie("Direct", gPanoMovieID, "set", pHandlerName, "test" & pHandlerName)
  310.   else
  311.     PanoMovie("Direct", gPanoMovieID, "set", pHandlerName, EMPTY)
  312.   end if
  313. end
  314.  
  315. on TestMouseOverHandler
  316.   global gPanoMovieID
  317.   if gPanoMovieID <> EMPTY then
  318.     put "In mouse over at: " & the ticks into field "MouseOverHandler Message"
  319.   end if
  320. end
  321.  
  322. on TestRolloverHotSpotHandler pHotSpotID
  323.   global gPanoMovieID
  324.   if gPanoMovieID <> EMPTY then
  325.     put "Rolling over hot spot: " & pHotSpotID into field "RolloverHotSpotHandler Message"
  326.   end if
  327. end
  328.  
  329. on TestMouseDownHandler
  330.   global gPanoMovieID
  331.   if gPanoMovieID <> EMPTY then
  332.     put "In mouse down at: " & the ticks into field "MouseDownHandler Message"
  333.     PanoMovie("Direct", gPanoMovieID, "PassMouseDown")
  334.   end if
  335. end
  336.  
  337. on TestPanZoomStartHandler
  338.   global gPanoMovieID
  339.   if gPanoMovieID <> EMPTY then
  340.     put "In pan zoom start at: " & the ticks into field "PanZoomStartHandler Message"
  341.   end if
  342. end
  343.  
  344. on TestMouseStillDownHandler
  345.   global gPanoMovieID
  346.   if gPanoMovieID <> EMPTY then
  347.     put "In mouse still down at: " & the ticks into field "MouseStillDownHandler Message"
  348.     put PanoMovie("Direct", gPanoMovieID, "get", "hpanangle") into field "MouseStillDownHandler Message"
  349.   end if
  350. end
  351.  
  352. on TestNodeLeaveHandler pToNode
  353.   global gPanoMovieID
  354.   if gPanoMovieID <> EMPTY then
  355.     put "Leaving node ID: " & pToNode into field "NodeLeaveHandler Message"
  356.   end if
  357. end
  358.  
  359. factory CallBackTracer
  360. method mnew
  361.  
  362. method mEvalExpr pExpr
  363.  
  364. method mSendHCMessage pMessage
  365.  
  366. method mSendCardMessage pMessage
  367.   do(pMessage)
  368.  
  369. method mGetFieldByName pCard, pName
  370.  
  371. method mGetFieldByNum pCard, pNum
  372.  
  373. method mGetFieldByID pCard, pID
  374.  
  375. method mSetFieldByName pCard, pName, pValue
  376.  
  377. method mSetFieldByNum pCard, pNum, pValue
  378.  
  379. method mSetFieldByID pCard, pID, pValue
  380.